﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;
using KL.Store.Core.Domain;
using KL.Store.Core.Domain.Enum;
using KL.Store.Data;
using KL.Store.Core;

namespace KL.Store.Web.Models
{
    #region CartModel

    public class CartModel
    {
        public IList<Cart> Products = new List<Cart>();
        public decimal Price { get; set; }
        public decimal Tax { get; set; }
        public decimal TotalPrice { get; set; }
        public decimal TotalPriceCreditCard { get; set; }
        public string Contract { get; set; }
        public bool ShowPhotos { get; set; }
        public bool ShowAcrIcrLinks { get; set; }
        public int AccountType { get; set; }
        public bool BasketLocked { get; set; }
    }

    #endregion

    #region CartSummary

    public class Summary : CartSummary
    {
    }

    #endregion

    #region CartCheckOutModel

    public class CartCheckOutModel
    {
        #region Constructor

        public CartCheckOutModel()
        {
            VoucherList = new List<Voucher>();
            PromotionProducts = new List<Product>();
            CargoWithInvoice = true;
            IsTotalPayment = true; // Total Payment
            PaymentType = PaymentTypes.KrediKart;
            PosList = new List<PosDDL>();
            BinList = new List<PosBin>();
            SelectedCargoCompanyId = Parameters.DefaultCargoCompanyId;
            CargoList = new List<Cargo>();
            BankList = new List<Bank>();
            ContractText = "";
            CargoAddress = new Address();
            InvoiceAddress = new Address();
            Use3D = false;
            Type3D = "";
            ItemCount = 0;
            FreeCargoInCityAvailable = false;
            AgreementChecked = 0;
            GuarantorNotSelectedAgreed = 0;
            TransportPrice = 0;
            TransportAvailable = false;
            TransportMinPriceRequired = false;
            InstallationPrice = 0;
            VoucherPosId = 0;
        }

        #endregion

        #region UserName

        public string UserName { get; set; }
        [Display(Name = "Adınız")]
        public string FirstName { get; set; }
        [Display(Name = "Soyadınız")]
        public string LastName { get; set; }
        [Display(Name = "TC Kimlik No")]
        public string TCKimlik { get; set; }
        [Display(Name = "E-Posta Adresiniz")]
        public string Email { get; set; }
        [Display(Name = "Mobil Telefon Numaranız")]
        public string Mobile { get; set; }
        public int UserId { get; set; }
        public int UserType { get; set; }

        #endregion

        #region SelectedAction

        public string SelectedAction { get; set; }
        #endregion

        #region SummaryCargo

        public CartSummaryCargo SummaryCargo { get; set; }

        #endregion

        #region Addresses

        public Address CargoAddress { get; set; }
        public Address InvoiceAddress { get; set; }

        #endregion

        #region Cargo

        public short SelectedCargoCompanyId { get; set; }

        public short CargoAddressId { get; set; }
        public short InvoiceAddressId { get; set; }
        public IList<AddressDDL> CargoAddresses { get; set; }

        public decimal CargoVolume { get; set; }
        public decimal CargoWeight { get; set; }

        [Display(Name = "Kargo Bedeli :")]
        public decimal CargoPrice { get; set; }

        public decimal CargoVolume2 { get; set; }
        public decimal CargoWeight2 { get; set; }

        [Display(Name = "Hediye Ürün Kargo Payı :")]
        public decimal CargoPrice2 { get; set; }

        [Display(Name = "Toplam Kargo Bedeli :")]
        public decimal CargoTotalPrice { get; set; }

        public bool CargoWithInvoice { get; set; }
        public decimal CargoInvoicePrice { get; set; }

        public IList<Cargo> CargoList { get; set; }
        public bool FreeCargoInCityAvailable { get; set; }

        #endregion

        #region Nakliye
        [Display(Name = "Nakliye Bedeli :")]
        public decimal TransportPrice { get; set; }
        public bool TransportAvailable { get; set; }
        public bool TransportMinPriceRequired { get; set; }

        public decimal InstallationPrice { get; set; }
        public bool InstallationAvailable { get; set; }

        #endregion

        public bool OppoturnityProductsAvailable { get; set; }

        #region Pos

        public IList<PosDDL> PosList { get; set; }
        public IList<PosInstallment> PosInstallmentList { get; set; }
        public IList<PosInstallment> PosInstallmentListVoucher { get; set; }
        public IList<PosBin> BinList { get; set; }
        public int SelectedPos { get; set; }
        public int SelectedInstallment { get; set; }
        public string SelectedPosDescription { get; set; }
        public bool SelectedPosEnabled3D { get; set; }
        public string Type3D { get; set; }
        public int ItemCount { get; set; }

        public int VoucherPosId { get; set; }

        [Display(Name = "3D Ödeme")]
        public bool Use3D { get; set; }

        #endregion

        #region Voucher

        public IList<Voucher> VoucherList { get; set; }

        #endregion

        #region Credit Card

        public bool UseCreditCard { get; set; }

        //[Required(ErrorMessage = "*")]
        [Display(Name = "Kart Üzerindeki İsim")]
        public string CardOwnerName { get; set; }

        [Display(Name = "Kart Numarası")]
        public string CardNumber { get; set; }

        //[Required(ErrorMessage = "*")]
        //[StringLength(4, MinimumLength = 4, ErrorMessage = "*")]
        public string CardNumber1 { get; set; }

        //[Required(ErrorMessage = "*")]
        //[StringLength(4, MinimumLength = 4, ErrorMessage = "*")]
        public string CardNumber2 { get; set; }

        //[Required(ErrorMessage = "*")]
        //[StringLength(4, MinimumLength = 4, ErrorMessage = "*")]
        public string CardNumber3 { get; set; }

        //[Required(ErrorMessage = "*")]
        //[StringLength(4, MinimumLength = 4, ErrorMessage = "*")]
        public string CardNumber4 { get; set; }

        //[Required(ErrorMessage = "*")]
        [Display(Name = "Son Kullanma Tarihi")]
        public short ValidMonth { get; set; }

        //[Required(ErrorMessage = "*")]
        public short ValidYear { get; set; }

        //[Required(ErrorMessage = "*")]
        [Display(Name = "Güvenlik Kodu (CVV)")]
        //[StringLength(3, MinimumLength = 3,ErrorMessage="*")]
        //[RegularExpression("[0-9][0-9][0-9]", ErrorMessage = "*")]
        //[Range(typeof(Decimal), "0", "999", ErrorMessage = "{0} must be a decimal/number between {1} and {2}.")]
        public string CVV { get; set; }

        #endregion

        #region Payment Type

        public PaymentTypes PaymentType { get; set; }
        public bool IsTotalPayment { get; set; }
        public decimal TotalPayment { get; set; }
        public bool UseTransferDiscount { get; set; }
        public decimal TotalPaymentWithTransfer { get; set; }
        public decimal TotalPaymentWithCreditCard { get; set; }

        public decimal CampaignTotalPayment { get; set; }
        public decimal CampaignTotalPaymentWithCreditCard { get; set; }

        public decimal? PartialPayment { get; set; }

        public int NonTransferPaymentCount { get; set; }

        #endregion

        #region PromotionProducts

        public IList<Product> PromotionProducts = new List<Product>();

        #endregion

        #region Bank

        public IList<Bank> BankList { get; set; }
        public int SelectedBank { get; set; }
        #endregion

        #region Messages

        public string Message1 { get; set; }
        public string Message2 { get; set; }
        public string Message3 { get; set; }
        public string Message4 { get; set; }
        public string Message5 { get; set; }
        public string Message6 { get; set; }
        public string Message7 { get; set; }
        public string Message8 { get; set; }
        public string Message9 { get; set; }
        public string Message10 { get; set; }
        public string Message11 { get; set; }
        public string Message12 { get; set; }

        #endregion

        #region Contract

        public string ContractText { get; set; }
        public decimal ContractTotalPrice { get; set; }

        #endregion

        public string PromoCode { get; set; }

        [Display(Name = "Notunuz")]
        public string OrderNote { get; set; }


        /*senet-kredi*/
        [Display(Name = "Taksit Sayısı")]
        public int OtherInstallment { get; set; }
        [Display(Name = "Adı ve Soyadı")]
        public string OtherNameSurname { get; set; }
        [Display(Name = "TC Kimlik Numarası")]
        public string OtherTcKimlikNo { get; set; }
        [Display(Name = "Aylık Gelir")]
        public string OtherMonthlyIncoming { get; set; }
        [Display(Name = "Anne Adı")]
        public string OtherMotherName { get; set; }
        [Display(Name = "Baba Adı")]
        public string OtherFatherName { get; set; }


        public int VoucherAvailable { get; set; }
        public Nufus Kimlik { get; set; }
        public List<GuarantorDDL> GuarantorList { get; set; }
        public List<GuarantorDDL> GuarantorList2 { get; set; }
        public int Guarantor1Id { get; set; }
        public Guarantor Guarantor1 { get; set; }
        public int Guarantor2Id { get; set; }
        public Guarantor Guarantor2 { get; set; }
        public decimal VoucherRate { get; set; }

        /*senet-kredi*/

        #region 3D Secure

        public string CAVV { get; set; }
        public string ECI { get; set; }

        #endregion

        public int MaxInstallmentCount { get; set; }
        public int AddressCompleted { get; set; }
        public bool VisitorRegistered { get; set; }
        public bool CustomPaymentCaptchaVerified { get; set; }
        public int AgreementChecked { get; set; }
        public int GuarantorNotSelectedAgreed { get; set; }
        public bool BasketLocked { get; set; }
    }

    #endregion

    #region PaymentSucceededModel

    public class PaymentSucceededModel
    {
        public PaymentSucceededModel()
        {
            IList<Voucher> Payments = new List<Voucher>();
            IList<PaymentSucceededMessage> Messages = new List<PaymentSucceededMessage>();
        }

        public int OrderId { get; set; }
        public IList<Voucher> Payments { get; set; }
        public IList<PaymentSucceededMessage> Messages { get; set; }
        public string Link { get; set; }
        public string UcuzuTrustedShopScript { get; set; }
        public string PaymentDate { get; set; }
    }

    public class PaymentSucceededMessage
    {
        public short PaymentType { get; set; }
        public string Message { get; set; }
    }

    #endregion
}
